home *** CD-ROM | disk | FTP | other *** search
-
- {
- if(true)
- {
- CHUDIcon = §§newclass(CHUDIcon,MovieClip);
- }
- }
-
- package Local.Game.HUD
- {
- import Local.*;
- import Local.Audio.*;
- import Local.Game.Level.*;
- import Local.Game.Thing.*;
- import Local.Game.World.*;
- import Local.Game.World.Map.*;
- import Local.Game.World.Map.Cell.*;
- import STC9.IO.*;
- import STC9.System.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.text.*;
-
- public class CHUDIcon extends MovieClip
- {
-
- public static const IconHeight:int = 60;
-
- public static const LAUNCH:String = "LAUNCH";
-
- public static const RDCOMPLETE:String = "RDCOMPLETE";
-
- public static const IconWidth:int = 60;
-
-
- private var mMaxBuildAmount:int;
-
- internal var mID:String;
-
- private var mBuildTime:int;
-
- private var mcControls:MovieClip;
-
- private var _BuildAmount:int;
-
- private var mcGraphic:MovieClip;
-
- public var mDesc_Launch:String = "launch";
-
- private var _Cost:Number;
-
- private var mMouseFilterID:String;
-
- private var mAction:String;
-
- private var aHilight:Boolean;
-
- public var mDesc_LaunchSelected:String = "launchselected";
-
- internal var mHUD:CHUD;
-
- private var mLibClass:String;
-
- private var mBuildCount:int;
-
- internal var mPanel:CHUDPanel;
-
- private var _Index:int;
-
- public var mDesc_Normal:String = "normal";
-
- public function CHUDIcon(param1:String, param2:MovieClip, param3:String, param4:Boolean, param5:Number, param6:Number, param7:Number, param8:String = "strike")
- {
- mDesc_Normal = "normal";
- mDesc_Launch = "launch";
- mDesc_LaunchSelected = "launchselected";
- super();
- if(param2.parent)
- {
- param2.parent.removeChild(param2);
- }
- addChild(param2);
- mcGraphic = param2;
- mcControls = mcGraphic.mcControls;
- mID = param1;
- mAction = param3.toUpperCase();
- mBuildTime = param5;
- mMaxBuildAmount = param6;
- mBuildAmount = 0;
- mCost = param7;
- mBuildCount = 0;
- mBuild = false;
- mHilight = false;
- mLaunch = false;
- mLaunchAuto = false;
- mLaunchSelected = false;
- mInsufficientFunds = false;
- mAvailable = param4;
- aHilight = false;
- mcControls.tbCount.visible = mMaxBuildAmount > 1;
- mMouseFilterID = param8;
- addEventListener(Event.ADDED_TO_STAGE,Initialize);
- }
-
- public function get mBuild() : Boolean
- {
- return mcControls.mcBuild.visible;
- }
-
- public function set mBuild(param1:Boolean) : void
- {
- if(mcControls.mcBuild.visible == param1)
- {
- return;
- }
- mcControls.mcBuild.alpha = 0;
- mcControls.mcBuild.visible = param1;
- }
-
- private function ACTION_SPAWN() : void
- {
- mHUD.mLevel[mAction + "_" + mID](mCost);
- }
-
- public function get mMouse() : CMouse
- {
- return mHUD.mGame.mWorld.mMouse;
- }
-
- public function set mInsufficientFunds(param1:Boolean) : void
- {
- if(mcControls.mcInsufficientFunds.visible != param1)
- {
- mcControls.mcInsufficientFunds.visible = param1;
- Activate(!param1);
- }
- }
-
- public function MakeAvailable() : void
- {
- mAvailable = true;
- Activate(true);
- }
-
- public function Build() : Boolean
- {
- §§push(mBuildAmount);
- §§push(mMaxBuildAmount);
- if(true)
- {
- if(§§pop() >= §§pop())
- {
- return false;
- }
- §§push(mHUD);
- if(true)
- {
- §§push(§§pop().mFunds);
- if(true)
- {
- §§push(§§pop() - mCost);
- }
- if(§§pop() < 0)
- {
- return false;
- }
- §§push(mHUD);
- }
- §§push(mHUD.mFunds);
- if(true)
- {
- §§push(§§pop() - mCost);
- }
- §§pop().mFunds = §§pop();
- mBuild = true;
- §§push(mBuildAmount);
- §§push(0);
- }
- if(§§pop() == §§pop())
- {
- mBuildCount = 0;
- }
- var _loc1_:*;
- var _loc2_:* = (_loc1_ = §§findproperty(mBuildAmount)).mBuildAmount + 1;
- _loc1_.mBuildAmount = _loc2_;
- return true;
- }
-
- private function e_ICON_UP(param1:MouseEvent = null) : void
- {
- if(true)
- {
- if(mLaunch)
- {
- if(false)
- {
- addr55:
- CAudio.PlayGlobalSound(Click);
- }
- }
- else if(aHilight)
- {
- if(true)
- {
- if(CKeyboard.IsDown("CONTROL"))
- {
- if(true)
- {
- if(CancelBuild())
- {
- if(true)
- {
- CAudio.PlayGlobalSound(Click);
- }
- }
- §§goto(addr58);
- }
- }
- else if(!mInsufficientFunds)
- {
- §§goto(addr45);
- }
- return;
- }
- addr45:
- if(Build())
- {
- §§goto(addr55);
- }
- §§goto(addr58);
- }
- }
- addr58:
- }
-
- public function Process() : void
- {
- var _loc1_:Number = NaN;
- if(true)
- {
- §§push(mAvailable);
- if(true)
- {
- if(!§§pop())
- {
- if(true)
- {
- return;
- }
- }
- else
- {
- addr23:
- if(mBuild)
- {
- if(true)
- {
- var _loc2_:*;
- §§push((_loc2_ = §§findproperty(mBuildCount)).mBuildCount);
- if(true)
- {
- _loc2_.mBuildCount = _loc3_;
- var _loc3_:*;
- §§push(_loc3_ = §§pop() + 1);
- }
- if(true)
- {
- _loc1_ = §§pop() / mBuildTime;
- if(true)
- {
- mcControls.mcBuild.alpha = 0.56;
- if(true)
- {
- mcControls.mcBuild.gotoAndStop(Math.floor(_loc1_ * mcControls.mcBuild.totalFrames) + 1);
- if(true)
- {
- if(_loc1_ >= 1)
- {
- this["ACTION_" + mAction]();
- }
- addr116:
- §§push(§§findproperty(mInsufficientFunds));
- if(true)
- {
- if(mHUD.mFunds < mCost)
- {
- addr123:
- §§push(true);
- if(true)
- {
- }
- }
- else
- {
- §§push(false);
- }
- §§pop().mInsufficientFunds = §§pop();
- §§goto(addr136);
- }
- §§goto(addr123);
- }
- _loc3_ = (_loc2_ = §§findproperty(mBuildAmount)).mBuildAmount - 1;
- if(true)
- {
- _loc2_.mBuildAmount = _loc3_;
- }
- }
- addr103:
- if(mBuildAmount <= 0)
- {
- addr105:
- mBuild = false;
- }
- else
- {
- mBuildCount = 0;
- }
- mcControls.tbCount.text = mBuildAmount;
- §§goto(addr116);
- }
- §§goto(addr105);
- }
- §§goto(addr103);
- }
- §§goto(addr105);
- }
- }
- §§goto(addr116);
- }
- §§goto(addr23);
- }
- addr136:
- }
-
- public function get mLaunchAuto() : Boolean
- {
- return mcControls.mcLaunchAuto.visible;
- }
-
- public function get mIndex() : int
- {
- return _Index;
- }
-
- public function set mLaunchSelected(param1:Boolean) : void
- {
- if(true)
- {
- mcControls.mcLaunchSelected.visible = param1;
- }
- }
-
- public function get mLaunch() : Boolean
- {
- return mcControls.mcLaunch.visible;
- }
-
- private function ACTION_CLAUNCH() : void
- {
- mLaunchAuto = true;
- }
-
- private function e_LAUNCH_OUT(param1:MouseEvent = null) : void
- {
- mHilight = false;
- mHUD.ResetDescription();
- }
-
- public function set mIndex(param1:int) : void
- {
- _Index = param1;
- visible = _Index < 5;
- }
-
- public function set mLaunchAuto(param1:Boolean) : void
- {
- mcControls.mcLaunchAuto.visible = param1;
- }
-
- private function ACTION_RD() : void
- {
- dispatchEvent(new Event(RDCOMPLETE));
- }
-
- public function Deselect() : void
- {
- if(!mLaunchSelected)
- {
- return;
- }
- mLaunchSelected = false;
- mMouse.removeEventListener(CMouse.ACTION_LAUNCHSTRIKE,e_ACTION_LAUNCHSTRIKE);
- }
-
- public function get mAvailable() : Boolean
- {
- return !mcControls.mcAvailable.visible;
- }
-
- private function e_LAUNCH_OVER(param1:MouseEvent = null) : void
- {
- mHilight = true;
- §§push(mHUD);
- if(true)
- {
- §§pop().mDescription = mLaunchSelected ? mDesc_LaunchSelected : mDesc_Launch;
- return;
- }
- §§goto(addr17);
- }
-
- public function set mHilight(param1:Boolean) : void
- {
- mcControls.mcHilight.visible = param1;
- }
-
- public function Activate(param1:Boolean) : void
- {
- if(true)
- {
- mcControls.mcButton.addEventListener(MouseEvent.MOUSE_OVER,e_ICON_OVER);
- if(true)
- {
- mcControls.mcButton.addEventListener(MouseEvent.MOUSE_OUT,e_ICON_OUT);
- if(true)
- {
- mcControls.mcButton.addEventListener(MouseEvent.MOUSE_UP,e_ICON_UP);
- mcControls.mcButton.buttonMode = true;
- }
- mcControls.mcButton.useHandCursor = true;
- }
- mHilight = false;
- }
- }
-
- private function e_ICON_OUT(param1:MouseEvent = null) : void
- {
- if(true)
- {
- aHilight = false;
- if(true)
- {
- mHUD.ResetDescription();
- if(true)
- {
- if(!mInsufficientFunds)
- {
- §§goto(addr30);
- }
- }
- return;
- }
- §§goto(addr30);
- }
- addr30:
- mHilight = false;
- }
-
- public function get mInsufficientFunds() : Boolean
- {
- return mcControls.mcInsufficientFunds.visible;
- }
-
- public function set mLaunch(param1:Boolean) : void
- {
- mcControls.mcLaunch.visible = param1;
- }
-
- private function SetMouseLaunch(param1:MovieClip) : void
- {
- if(true)
- {
- param1.addEventListener(MouseEvent.MOUSE_OVER,e_LAUNCH_OVER);
- if(true)
- {
- param1.addEventListener(MouseEvent.MOUSE_OUT,e_LAUNCH_OUT);
- if(true)
- {
- param1.addEventListener(MouseEvent.MOUSE_UP,e_LAUNCH_UP);
- }
- param1.buttonMode = true;
- }
- param1.useHandCursor = true;
- }
- }
-
- public function get mLaunchSelected() : Boolean
- {
- return mcControls.mcLaunchSelected.visible;
- }
-
- private function e_LAUNCH_UP(param1:MouseEvent = null) : void
- {
- var _loc2_:CHUDIcon = null;
- for each(_loc2_ in mPanel.mIcons)
- {
- if(this != _loc2_)
- {
- _loc2_.Deselect();
- }
- }
- if(!mLaunchSelected)
- {
- mLaunchSelected = true;
- mHUD.mDescription = mDesc_LaunchSelected;
- mMouse.mCurrentFilter = CMouse.mFilters[mMouseFilterID];
- mMouse.addEventListener(CMouse.ACTION_LAUNCHSTRIKE,e_ACTION_LAUNCHSTRIKE);
- CAudio.PlayGlobalSound(Click);
- }
- }
-
- private function set mBuildAmount(param1:int) : void
- {
- if(true)
- {
- _BuildAmount = param1;
- mcControls.tbCount.text = String(_BuildAmount);
- }
- }
-
- public function get mHilight() : Boolean
- {
- return mcControls.mcHilight.visible;
- }
-
- private function ACTION_NONE() : void
- {
- }
-
- private function e_ICON_OVER(param1:MouseEvent = null) : void
- {
- aHilight = true;
- mHUD.mDescription = mDesc_Normal;
- if(mInsufficientFunds)
- {
- return;
- }
- mHilight = true;
- }
-
- public function Initialize(param1:Event = null) : void
- {
- if(true)
- {
- mPanel = MovieClip(parent).mPanel;
- if(true)
- {
- mHUD = mPanel.mHUD;
- if(true)
- {
- removeEventListener(Event.ADDED_TO_STAGE,Initialize);
- }
- SetMouseLaunch(mcControls.mcLaunch);
- }
- SetMouseLaunch(mcControls.mcLaunchAuto);
- }
- }
-
- private function e_ACTION_LAUNCHSTRIKE(param1:Event = null) : void
- {
- if(true)
- {
- mLaunch = false;
- if(true)
- {
- dispatchEvent(new Event(LAUNCH));
- }
- Deselect();
- }
- }
-
- private function get mBuildAmount() : int
- {
- return _BuildAmount;
- }
-
- public function set mCost(param1:Number) : void
- {
- if(true)
- {
- _Cost = param1;
- mcControls.tbCost.text = CHUD.NumberToDollar(Math.floor(_Cost));
- }
- }
-
- public function set mAvailable(param1:Boolean) : void
- {
- mcControls.mcAvailable.visible = !param1;
- }
-
- public function get mCost() : Number
- {
- return _Cost;
- }
-
- private function ACTION_LAUNCH() : void
- {
- mLaunch = true;
- }
-
- public function CancelBuild() : Boolean
- {
- §§push(mBuildAmount);
- if(true)
- {
- §§push(0);
- if(true)
- {
- if(§§pop() == §§pop())
- {
- return false;
- }
- addr34:
- §§push(mHUD);
- §§push(mHUD.mFunds);
- if(true)
- {
- §§push(§§pop() + mCost);
- }
- §§pop().mFunds = §§pop();
- §§push(mBuildAmount);
- §§push(1);
- }
- if(§§pop() == §§pop())
- {
- mBuild = false;
- }
- var _loc1_:*;
- var _loc2_:* = (_loc1_ = §§findproperty(mBuildAmount)).mBuildAmount - 1;
- if(true)
- {
- _loc1_.mBuildAmount = _loc2_;
- }
- return true;
- }
- §§goto(addr34);
- }
-
- public function Dispose() : void
- {
- §§push(mPanel);
- if(true)
- {
- if(§§pop())
- {
- addr14:
- mPanel.RemoveIcon(this);
- }
- return;
- }
- §§goto(addr14);
- }
- }
- }
-